<?php 
class Zen_Controller_Action_Helper_Preview extends Zend_Controller_Action_Helper_Abstract{
		
	public function direct($res = null){
		if (Zen_User::isLoged ()) {
			$acl = Zen_Acl::getInstance();
			$user = Zen_User::getOne ( Zen_User::getId () );
			if (! $acl->isAllowed ( $user ['role'], 'adminka' )) {
				throw new Zend_Controller_Router_Exception('', 404);
			}else{
				$controller_name = $this->getRequest()->getControllerName();
				$module_name = $this->getRequest()->getModuleName();
				if (! $res) {
					$res = $this->getRequest()->getParams();
				}
				$action = $this->getActionController();
				$helper = new Zend_Controller_Action_HelperBroker($action);
				$helper->layout->setLayout ( 'preview' );
				$front = Zend_Controller_Front::getInstance ();
				$front	->unregisterPlugin('Block_Plugin_Block')
						->unregisterPlugin('Admin_Plugin_Bar');
				$this->getActionController()->view->res = $res;
			}
		} else {
			throw new Zend_Controller_Router_Exception('', 404);
		}
		
	}

}